Display the elements in an array one at a time using getkeydown in unity
88
Display the elements in an array one at a time using getkeydown in unity -
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class LoadImage : MonoBehaviour {
[SerializeField] private Image newImage;
[SerializeField] Image[] nextImage;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
GetNextImage();
}
private Image GetNextImage()
{
if (Input.GetKeyDown(KeyCode.RightArrow))
{
for (int i = 0; i < nextImage.Length; i++)
{
newImage = nextImage[i];
newImage.enabled = true;
}
}
return newImage;
}
}